<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
	<div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>
	<div id="mainownservice">
		<h3>
			<?php 
				if($this->type == 'fee'){
					echo JText::_('OWNSERVICE_FEE'); 
				} else {
					echo JText::_('OWNSERVICE_DESTINATION_FEE');
				}
			?>
		</h3>
		<hr />
		<?php if($this->access->canAdd): ?>
		<div id="toolbar">
			<a class="toolbar" onclick="javascript: submitbutton('add')" href="#">
				<span title="<?php echo JText::_('OWNSERVICE_NEW_FEE'); ?>" class="icon-32-new"></span>
				<?php 
					echo JText::_('OWNSERVICE_NEW_RULE'); 
				?>
			</a>
			<a class="toolbar" href="<?php echo JRoute::_('index.php?option=com_ownservice&controller=exchangerate&task=edit&id='.$this->rate_id); ?>">
				<span title="<?php echo JText::_('OWNSERVICE_BACK'); ?>" class="icon-32-back"></span>
				<?php
					echo JText::_('OWNSERVICE_BACK');
				?>
			</a>
		</div>
		<div class="clear"> </div>
		<?php endif; ?>
	
		<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">
			<table class="adminlist" cellspacing="1">
				<tr>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_FROM', 'from', $this->lists['order_Dir'], $this->lists['order'] ); ?><br />(AUD)</td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_TO', 'to', $this->lists['order_Dir'], $this->lists['order'] ); ?><br />(AUD)</td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  ($this->type == 'fee')?'OWNSERVICE_FEE':'OWNSERVICE_DESTINATION_FEE', 'fee', $this->lists['order_Dir'], $this->lists['order'] ); ?><br />
						<?php 
							if($this->type == 'fee')
							{
								echo '(AUD)';
							} else {
								echo '('.$this->rate->code.')';	
							}
						?>
					</td>
					<td align="center" class="tablelist"><?php echo JText::_('OWNSERVICE_SELECT_ACTION'); ?></td>
				</tr>
				<?php
					$k = 0;
					$priceformat = OwnserviceHelper::getParams('price_format', '#,###.##');
			
					for($i=0,$n=count($this->rows);$i<$n;$i++):
					$row 	= $this->rows[$i];
					//$link	= JRoute::_('index.php?option=com_ownservice&controller=fee&task=edit&rate_id='.$this->rate_id.'&type='.$this->type.'&id='.$row->id);
				?>
			
				<tbody>
				<tr class="<?php echo "row$k"; ?>">
			
					<td class="inner_tablelist" align="center">
						<?php /*<a href="<?php echo $link; ?>">*/?><?php echo OwnserviceHelper::moneyFormat($priceformat,$row->from); ?><?php /*</a>*/ ?>
					</td>
					<td class="inner_tablelist" align="center"><?php echo OwnserviceHelper::moneyFormat($priceformat,$row->to); ?></td>
					<td class="inner_tablelist" align="center"><?php echo OwnserviceHelper::moneyFormat($priceformat,$row->fee); ?></td>
					<td class="inner_tablelist" align="center">
						<select class="inputbox" name="action" id="action" onChange="listTaskAction(<?php echo $row->id ?>,this.value);">
							<option value="" selected><?php echo JText::_('OWNSERVICE_PLEASE_SELECT'); ?></option>
							<?php if($this->access->canEdit) : ?><option value="edit"><?php echo JText::_('OWNSERVICE_EDIT');?></option><?php endif; ?>
							<?php if($this->access->canDelete) : ?><option value="delete"><?php echo JText::_('OWNSERVICE_DELETE');?></option><?php endif; ?>
						</select>
					</td>
				</tr>
				<?php $k = 1 - $k; endfor; ?>
				</tbody>
			
			</table>
			
			<input type="hidden" name="rate_id" value="<?php echo $this->rate_id; ?>" />
			<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
			<input type="hidden" name="type" value="<?php echo $this->type; ?>" />
			<input type="hidden" name="option" value="com_ownservice" />
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />
			<input type="hidden" name="controller" value="fee" />
			<input type="hidden" name="view" value="fees" />
			<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
			<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
			<?php echo JHTML::_( 'form.token' ); ?>
		</form>
	</div>
</div>